package com.ticket.sass.provider.validator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Documented
@Retention(RUNTIME)
@Constraint(validatedBy = InEnumValidator.class)
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
public @interface InEnum {

    String message() default "必须在指定范围 {value}";

    String[] strValues() default {};

    int[] intValues() default {};

    Class<? extends Payload>[] payload() default {};

    Class<?>[] groups() default {};

    @Documented
    @Retention(RUNTIME)
    @Target({FIELD, METHOD, PARAMETER, ANNOTATION_TYPE})
    @interface List {
        InEnum[] value();
    }
}
